<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateCategoryShopPivotTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('category_shop_pivot', function (Blueprint $table) {
			$table->unsignedInteger('category_id')->index()->comment('分类ID');
			$table->unsignedInteger('shop_id')->index()->comment('门店ID');
			$table->primary(['category_id', 'shop_id'])->comment('复合主键');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('category_shop_pivot');
    }
}
